package com.zhl.entity;

/**
 * Created by Administrator on 2018/11/2.
 */
public class ZhlResult {
    private int code;
    private String message;
    private int totalSize;
    private int totalCount;
    //相应中的数据
    private Object data;

    public ZhlResult() {
    }

    public ZhlResult(int code, String message, int totalSize, int totalCount, Object data) {
        this.code = code;
        this.message = message;
        this.totalSize = totalSize;
        this.totalCount = totalCount;
        this.data = data;
    }

    public ZhlResult(int code, String message,Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }


    public static ZhlResult ok(Object data) {
        return new ZhlResult(200,"OK",data);
    }

    public static ZhlResult ok() {
        return new ZhlResult(200,"OK",null);
    }

    public static ZhlResult build(int code, String message) {
        return new ZhlResult(code,message,null);
    }

    public static ZhlResult fail(Object data) {
        return new ZhlResult(400,"fail",data);
    }
    public static ZhlResult fail() {
        return new ZhlResult(400,"fail",null);
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getTotalSize() {
        return totalSize;
    }

    public void setTotalSize(int totalSize) {
        this.totalSize = totalSize;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
